package com.guodi.map.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guodi.map.entity.MapScene;
import com.guodi.map.mapper.MapSceneMapper;
import com.guodi.map.service.IMapSceneService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author pwm
 */
@Service
public class MapSceneServiceImpl extends ServiceImpl<MapSceneMapper, MapScene> implements IMapSceneService {

    @Override
    public List<MapScene> listByEntity(MapScene mapScene) {
        LambdaQueryWrapper<MapScene> lambdaQueryWrapper = new QueryWrapper<MapScene>().lambda();
        if(StringUtils.isNotBlank(mapScene.getName())){
            lambdaQueryWrapper.like(MapScene::getName,mapScene.getName());
        }
        lambdaQueryWrapper.orderByAsc(MapScene::getSort);
        return this.list(lambdaQueryWrapper);
    }
}